#ifndef BASEGAUSSSEIDELSOLVER_H
#define BASEGAUSSSEIDELSOLVER_H
#include <QVector>
//#include <QThread>
#include <QObject>

class BaseGaussSeidelSolver: public QObject
{
    Q_OBJECT
protected:
    int n, m, k;
    double f1, f2;
    double h;
    double eps;
    double g_tr;
    int zone_count;
    bool unpenetration;
    bool friction;
    bool lagrange;
    QVector<double> l, lOld;
    QVector<double> x;
    QVector<int> coeffs_map;

    bool isStopped;
    typedef QVector<QVector<QVector<double> >  > Zone ;
    QVector<Zone> coeffs_list;
    virtual double iteration() = 0;
public:
    BaseGaussSeidelSolver(int _n, double mu1=0.3, double e1=2.1e6, QObject * parent = 0);
    ~BaseGaussSeidelSolver();
    void randomlyInitialize();
    void setF1(double f);
    void setF2(double f);
    void setEps(double e);
    void setG_tr(double gtr);
    void setUnpenetrationCondition(bool cond);
    void setFrictionCondition(bool cond);
    void setLagrangeFunctionCondition(bool cond);

    virtual double updateLagrange(double ro) = 0;

    virtual void showGraph() = 0;
    int solve();
    void stop();
};

#endif // BASEGAUSSSEIDELSOLVER_H
